import QtQuick 2.6
import QtQuick.Controls 1.5
import QtQuick.Layouts 1.1

import UiBase 1.0
import Config 1.0

import Cpp.Request 1.0 as Request

import "qrc:/Qml" as TCQml

import "Editor/Discover" as Discover
RowLayout {
    id:root

    property double simulatorWidth: simulatorContainer.width
    property double simulatorHeight: simulatorContainer.height
    property Item simulatorRoot: simulatorContainer
    property Item mainRoot: simulatorContainer
    property Item indexRoot: indexContainer
    property StackView editorRoot: editorContainer

    Item {
        id:simulatorContainer
        width: height / 1280 * 720
        height: parent.height
        Layout.preferredWidth: width
        Layout.preferredHeight: height
        ColumnLayout {
            anchors.fill: parent
            spacing: 0
            Item {
                id:indexContainer
                Layout.fillWidth: true
                Layout.fillHeight: true
                Loader {
                    id: indexLoader
                    anchors.fill: parent
                    sourceComponent: {
                        if(menuBar.page === "discover")
                            return discoverComponent
                    }
                }
            }

            TCQml.MenuBar {
                Layout.fillWidth: true
                Layout.preferredHeight: height
                id:menuBar
                page: "discover"
                TopDivider{
                }
            }
        }
    }

    StackView {
        id:editorContainer
        Layout.fillWidth: true
        Layout.fillHeight: true
    }

    Component {
        id:discoverComponent
        Discover.Index{}
    }
}
